]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-entry: don't possibly allocate actors a negative size
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 7 Jun 2017 00:56:17 +0000 (17:56 -0700)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 14 Jun 2017 21:00:57 +0000 (14:00 -0700)
Clutter will complain about this, so protect the code against such edge
case.

https://bugzilla.gnome.org/show_bug.cgi?id=783484

src/st/st-entry.c

index 82cf5c22e4209448de9763a6c8bff537f4c5d0e2..c92991e3fe5d574097e5f040e2b16c8394a4f9f1 100644 (file)
@@ -475,7 +475,7 @@ st_entry_allocate (ClutterActor          *actor,
       clutter_actor_allocate (left_icon, &icon_box, flags);
 
       /* reduce the size for the entry */
-      child_box.x1 += icon_w + priv->spacing;
+      child_box.x1 = MIN (child_box.x2, child_box.x1 + icon_w + priv->spacing);
     }
 
   if (right_icon)
@@ -492,7 +492,7 @@ st_entry_allocate (ClutterActor          *actor,
       clutter_actor_allocate (right_icon, &icon_box, flags);
 
       /* reduce the size for the entry */
-      child_box.x2 -= icon_w + priv->spacing;
+      child_box.x2 = MAX (child_box.x1, child_box.x2 - icon_w - priv->spacing);
     }
 
   clutter_actor_get_preferred_height (priv->entry, child_box.x2 - child_box.x1,